Process Files for Knowledge Base
Used to accept and process one or more files to be included in the knowledge base. This typically involves parsing, extracting content, and indexing the data for later retrieval and use by AI agents.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/kb/file |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/kb/file' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"project_key": "YOUR_PROJECT_KEY",
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"file_ids": [
"file_001",
"file_002",
"file_003"
]
}'
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Request Body
Request Body Schema
{
"project_key": "string",
"agent_id": "string",
"file_ids": ["string"]
}
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| project_key | string | Yes | The project key for your project. |
| agent_id | string | Yes | UUID of the AI agent to associate the files with. |
| file_ids | array | Yes | Array of file identifiers to process and add to the knowledge base. |
note
Files must be uploaded to the system before they can be processed. The file_ids should reference previously uploaded files.
Response
Success Response (200 OK)
Returns an object containing the processing status.
{
"is_success": true,
"detail": "Files processed and added to knowledge base successfully",
"error": {}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_success | boolean | Indicates whether the file processing was successful. |
| detail | string | Success or failure message with additional context. |
| error | object | Error details if the operation failed (empty if successful). |
tip
The processing of files may take some time depending on the file size and content complexity. The files will be parsed, content will be extracted, and the data will be indexed for retrieval by the AI agent.
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid.
{
"detail": [
{
"loc": [
"body",
"file_ids"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., body field). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | Successful Response | Success |
| 400 | Bad Request - Invalid file IDs or processing error | Bad Request |
| 422 | Validation Error - Invalid request parameters | Unprocessable Entity |